package com.xiaobai.zhuangxiuguanjia.model;

import org.json.JSONArray;
import org.json.JSONObject;

import java.util.ArrayList;
import java.util.List;

/**
 * Created by Administrator on 2015/6/16 0016.
 */
public class DesignData {
    private String type;
//    private List<DesignSpecial> designSpecialList;
//    private List<Design> designList;
    private List<CommonData> commonDataList;
    public void parseJSON(JSONObject json){
        type = json.optString("type");
        JSONArray infos = json.optJSONArray("info");
        commonDataList = new ArrayList<CommonData>();
        for (int i = 0; i < infos.length(); i++) {
            JSONObject jsonObject = infos.optJSONObject(i);
            CommonData commonData = new CommonData();
            commonData.parseJSON(jsonObject);
            commonDataList.add(commonData);
        }
//        if (type.equals("1")){
//            JSONArray info1 = json.optJSONArray("info");
//            designSpecialList = new ArrayList<DesignSpecial>();
//            for (int i=0;i<info1.length();i++){
//                JSONObject jsonObject = info1.optJSONObject(i);
//                DesignSpecial designSpecial = new DesignSpecial();
//                designSpecial.parseJSON(jsonObject);
//                designSpecialList.add(designSpecial);
//            }
//        }else if (type.equals("2")){
//            JSONArray info2 = json.optJSONArray("info");
//            designList = new ArrayList<Design>();
//            for (int i=0;i<info2.length();i++){
//                JSONObject jsonObject2 = info2.optJSONObject(i);
//                Design design = new Design();
//                design.parseJSON(jsonObject2);
//                designList.add(design);
//            }
//        }
    }

    public String getType() {
        return type;
    }

    public List<CommonData> getCommonDataList() {
        return commonDataList;
    }

    //    public List<DesignSpecial> getDesignSpecialList() {
//        return designSpecialList;
//    }
//
//    public List<Design> getDesignList() {
//        return designList;
//    }
}
